﻿// -------------------------------------------------------------------------
//    @FileName         :    NFSnsRoleSimpleService.cpp
//    @Author           :    gaoyi
//    @Date             :    2025-03-29
//    @Email			:    445267987@qq.com
//    @Module           :    NFSnsRoleSimpleService
//
// -------------------------------------------------------------------------

#include "NFSnsRoleSimpleService.h"

#include <NFComm/NFCore/NFCommon.h>

#include "NFSnsRoleSimple.h"
#include "NFTransBatchSimpleBase.h"
#include "NFTransLoadRoleSimple.h"
#include "NFLogicCommon/NFBaseDefine.h"
#include "NFServerComm/NFServerCommon/NFCacheDataMgr.h"

#define MIN_SCAN_NUM 100
#define LOAD_FACTOR (0.5f)
#define SCAN_FACTOR (0.1f)

#define MAX_TICK_ROLE_SIMPLE_NUM_PER_TICK 1000

NFSnsRoleSimple* NFSnsRoleSimpleService::GetRoleSimple(uint64_t ullRoleId)
{
    return dynamic_cast<NFSnsRoleSimple*>(NFCacheDataMgr::Instance()->GetCacheData(NFSnsRoleSimple::GetStaticClassType(), ullRoleId));
}

bool NFSnsRoleSimpleService::IsExistRoleSimpleInfo(uint64_t ullRoleId)
{
    return NFCacheDataMgr::Instance()->IsExistCacheData(NFSnsRoleSimple::GetStaticClassType(), ullRoleId);
}

int NFSnsRoleSimpleService::BatchLoadRoleSimpleInfo(uint64_t roleId, const std::vector<uint64_t>& vecRoleId, int iReason)
{
    return NFCacheDataMgr::Instance()->BatchLoadCacheData(NF_ST_SNS_SERVER, NFSnsRoleSimple::GetStaticClassType(), NFTransBatchSimpleBase::GetStaticClassType(), NFTransLoadRoleSimple::GetStaticClassType(), E_TABLE_SNS_ROLE_SIMPLE, roleId, vecRoleId, iReason);
}



